/* eslint-disable @typescript-eslint/no-empty-object-type */
import { Data } from "effect";

// Define a generic TaggedEnum for RemoteData
type RemoteData<Success, Failure> = Data.TaggedEnum<{
  Loading: {};
  Success: { data: Success };
  Failure: { reason: Failure };
}>;

// Extend TaggedEnum.WithGenerics to add generics
interface RemoteDataDefinition extends Data.TaggedEnum.WithGenerics<2> {
  readonly taggedEnum: RemoteData<this["A"], this["B"]>;
}

// Create constructors for the generic RemoteData
const { Loading, Failure, Success } = Data.taggedEnum<RemoteDataDefinition>();

// Instantiate each case with specific types
const loading = Loading();
const failure = Failure({ reason: "not found" });
const success = Success({ data: 1 });
